/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;

import java.awt.Image;
import java.util.Random;
import javax.swing.ImageIcon;

/**
 * Car class to manage car symbol character and for a future functional enhancement.
 * @author Chiaki Sato
 * @since J2SDK 1.6
 * @version 1.0
 */
public class Car {

    // private instance valiables
    private Image oImageCarHoriz;
    private Image oImageCarVert;

    /**
     * Constructor for the car class, no process.
     */
    public Car(){

        ImageIcon oIcon;

        Random oRandom = new Random();

        int nGifNum = oRandom.nextInt(3) +1;

//      after setting classpath, should change to the next code
//      ImageIcon oIcon = new ImageIcon(this.getClass().getClassLoader().getResource("car1_h.GIF"));
        oIcon = new ImageIcon(System.getProperty("user.dir") + "\\car" + nGifNum +"_h.GIF");
        oImageCarHoriz = oIcon.getImage();
        oIcon = new ImageIcon(System.getProperty("user.dir") + "\\car" + nGifNum +"_v.GIF");
        oImageCarVert = oIcon.getImage();
    }

    /**
     * Override function of toString to return a car symbol string.
     * @return Car symbol string
     */
    @Override
    public String toString(){
        return Const.SYMBOL_CAR;
    }

    public Image getImageCarHoriz() {
        return oImageCarHoriz;
    }

    public Image getImageCarVert() {
        return oImageCarVert;
    }
}
